
package modele;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Random;

import javax.imageio.ImageIO;

public class MTheme {
	
	/*
	 * Modele des themes d'images :
	 * -Construit à partir d'un entier
	 */
	
	protected ArrayList<BufferedImage> collect;
	
	public MTheme(int th) {
		collect = new ArrayList<BufferedImage>();
		try {
			switch (th)
			{
			case 1:
				
				collect.add(ImageIO.read(getClass().getResourceAsStream("fruit/fraise.png")));
				collect.add(ImageIO.read(getClass().getResourceAsStream("fruit/banane.png")));
				collect.add(ImageIO.read(getClass().getResourceAsStream("fruit/raisin.png")));
				collect.add(ImageIO.read(getClass().getResourceAsStream("fruit/poire.png")));
				collect.add(ImageIO.read(getClass().getResourceAsStream("fruit/cerise.png")));
				collect.add(ImageIO.read(getClass().getResourceAsStream("fruit/pomme.png")));
				break;
				
			case 2:
				collect.add(ImageIO.read(getClass().getResourceAsStream("vetement/chaussures.png")));
				collect.add(ImageIO.read(getClass().getResourceAsStream("vetement/chapeau.png")));
				collect.add(ImageIO.read(getClass().getResourceAsStream("vetement/chemise.png")));
				collect.add(ImageIO.read(getClass().getResourceAsStream("vetement/pantalon.png")));
				collect.add(ImageIO.read(getClass().getResourceAsStream("vetement/t-shirt.png")));
				collect.add(ImageIO.read(getClass().getResourceAsStream("vetement/chaussettes.png")));
				break;
				
			case 3:
				collect.add(ImageIO.read(getClass().getResourceAsStream("animaux/vache.png")));
				collect.add(ImageIO.read(getClass().getResourceAsStream("animaux/chevre.png")));
				collect.add(ImageIO.read(getClass().getResourceAsStream("animaux/cochon.png")));
				collect.add(ImageIO.read(getClass().getResourceAsStream("animaux/coq.png")));
				collect.add(ImageIO.read(getClass().getResourceAsStream("animaux/lapin.png")));
				collect.add(ImageIO.read(getClass().getResourceAsStream("animaux/cheval.png")));
				break;
	
			default:
				break;
			}
		}
		catch(IOException e) { e.printStackTrace(); }
	}
	
	public BufferedImage getNewImage() {
		Random gen = new Random();
		int index = gen.nextInt(collect.size()); 
		BufferedImage img = collect.get(index);
		collect.remove(index);
		return img;
	}

}
